
<!DOCTYPE html>
<html>
<head>
    <title></title>
    @include('system::admin.Layouts.index-layui-head')      </head>
<body>

<div class="layuimini-container">



    <div class="layuimini-main">

        <fieldset class="table-search-fieldset">
            <legend>搜索信息</legend>
            <div style="margin: 10px 10px 10px 10px">
                <form class="layui-form layui-form-pane" action="">
                    <div class="layui-form-item">

                        <div class="layui-inline">
                            <label class="layui-form-label">字段</label>
                            <div class="layui-input-inline">
                                <input type="text" data-search-type="like" name="field" autocomplete="off" class="layui-input">
                            </div>
                        </div>

                        <div class="layui-inline">
                            <label class="layui-form-label">表名</label>
                            <div class="layui-input-inline">
                                <select data-search-type="=" name="table_name" lay-verify="required">
                                    <option value="-1">全部</option>
                                    @foreach($formSearch[19]->option3 as $key=>$search_extend) <option value="{{$key}}">{{$search_extend}}</option> @endforeach
                                </select>
                            </div>
                        </div>





                        <div class="layui-inline">
                            <button type="submit" class="layui-btn layui-btn-primary"  lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
                        </div>

                    </div>
                </form>
            </div>
        </fieldset>

        <script type="text/html" id="toolbar">
            <div class="layui-btn-container">

                <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="add"> 添加 </button>
                <button class="layui-btn layui-btn-sm layui-btn-danger data-delete-btn" lay-event="delete"> 删除 </button>

            </div>
        </script>


        <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>


        <script type="text/html" id="currentTableBar">

            <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
            <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
            <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="generateCode_create">编辑页代码</a>
            <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="generateCode_index">列表页代码</a>

        </script>

    </div>

</div>

@include('system::admin.Layouts.index-layui-top')




<script>

    layui.use(['form', 'table','laydate','arrayJs','chinAdmin','allJs'], function () {

        var $ = layui.jquery, form = layui.form, table = layui.table,laydate = layui.laydate,chinAdmin = layui.chinAdmin,allJs = layui.allJs;

        //头部搜索初始化组件

        //所有的项配置
        var $cols = [
            {type: "checkbox", width: 50},
            //逐步放弃这种扩展方式，采用头部<script type="text/html" id="currentTableBar">块扩展
            {title: '操作', minWidth: 280, toolbar: '#currentTableBar', align: "center"},

            {field: 'name', width: '130', title: '字段名',sort: parseInt('0'),templet: function(d){
                    return d.name?d.name:'';
                }},
            {field: 'field', width: '130', title: '字段',sort: parseInt('0'),templet: function(d){
                    return d.field?d.field:'';
                }},
            {field: 'type', width: '90', title: '类型',sort: parseInt('0'),templet: function(d){
                    //下拉
                    var type_extends_5 = JSON.parse('{!! (gettype($form[18]->extends) == 'array')?json_encode($form[18]->extends):($form[18]->extends?$form[18]->extends:"{}") !!}');

                    for(var i in type_extends_5){
                        if(i == d.type){
                            return '<button type="button" class="layui-btn layui-btn-xs">'+type_extends_5[i]+'</button>';
                        }
                    }
                }},
            {field: 'table_name', width: '150', title: '表名',sort: parseInt('0'),templet: function(d){
                    //下拉
                    var table_name_extends_5 = JSON.parse('{!! (gettype($form[19]->extends) == 'array')?json_encode($form[19]->extends):($form[19]->extends?$form[19]->extends:"{}") !!}');

                    for(var i in table_name_extends_5){
                        if(i == d.table_name){
                            return '<button type="button" class="layui-btn layui-btn-xs">'+table_name_extends_5[i]+'</button>';
                        }
                    }
                }},
            {field: 'sort', width: '90', title: '排序',sort: parseInt('0'),templet: function(d){
                    return d.sort?d.sort:'';
                }},
            {field: 'extends', width: '90', title: '扩展信息',sort: parseInt('0'),templet: function(d){
                    return d.extends?d.extends:'';
                }},
            {field: 'required', width: '90', title: '是否需要',sort: parseInt('0'),templet: function(d){
                    //活动开关
                    var required_extends_13 = JSON.parse('{!! $form[22]->extends !!}');
                    //寻找扩展信息里面对应的汉字显示值。
                    for(var i in required_extends_13){
                        if(i == d.required){
                            return '<button type="button" class="layui-btn layui-btn-xs">'+required_extends_13[i].title+'</button>';
                        }
                    };
                    return "";
                }},
            {field: 'verify', width: '90', title: '验证方式',sort: parseInt('0'),templet: function(d){
                    if(d.verify == '' || d.verify == null){
                        return "";
                    }else{
                        //如果存的是个对象字符串就解析
                        if(d.verify.indexOf("{") != -1 ){
                            //复选框
                            var range = JSON.parse(d.verify);
                            var str = '';
                            for(var i in range){
                                str+=range[i]+" ";
                            }
                            return str;
                        }else{
                            return d.verify;
                        }
                    }
                }},
            {field: 'verify_ext', width: '80', title: '验证扩展信息',sort: parseInt('0'),templet: function(d){
                    return d.verify_ext?d.verify_ext:'';
                }},
            {field: 'display', width: '80', title: '是否显示',sort: parseInt('0'),templet: function(d){
                    //活动开关
                    var display_extends_13 = JSON.parse('{!! $form[82]->extends !!}');
                    //寻找扩展信息里面对应的汉字显示值。
                    for(var i in display_extends_13){
                        if(i == d.display){
                            return '<button type="button" class="layui-btn layui-btn-xs">'+display_extends_13[i].title+'</button>';
                        }
                    };
                    return "";
                }},
            {field: 'is_sort', width: '80', title: '是否排序',sort: parseInt('0'),templet: function(d){
                    //活动开关
                    var is_sort_extends_13 = JSON.parse('{!! $form[83]->extends !!}');
                    //寻找扩展信息里面对应的汉字显示值。
                    for(var i in is_sort_extends_13){
                        if(i == d.is_sort){
                            return '<button type="button" class="layui-btn layui-btn-xs">'+is_sort_extends_13[i].title+'</button>';
                        }
                    };
                    return "";
                }},
            {field: 'width', width: '80', title: '宽度',sort: parseInt('0'),templet: function(d){
                    return d.width?d.width:'';
                }},
            {field: 'search_type', width: '80', title: '搜索扩展',sort: parseInt('0'),templet: function(d){
                    //下拉
                    var search_type_extends_5 = JSON.parse('{!! (gettype($form[85]->extends) == 'array')?json_encode($form[85]->extends):($form[85]->extends?$form[85]->extends:"{}") !!}');

                    for(var i in search_type_extends_5){
                        if(i == d.search_type){
                            return '<button type="button" class="layui-btn layui-btn-xs">'+search_type_extends_5[i]+'</button>';
                        }
                    }
                }},
            {field: 'is_create', width: '80', title: '是否添加编辑',sort: parseInt('0'),templet: function(d){
                    //活动开关
                    var is_create_extends_13 = JSON.parse('{!! $form[86]->extends !!}');
                    //寻找扩展信息里面对应的汉字显示值。
                    for(var i in is_create_extends_13){
                        if(i == d.is_create){
                            return '<button type="button" class="layui-btn layui-btn-xs">'+is_create_extends_13[i].title+'</button>';
                        }
                    };
                    return "";
                }},
            {field: 'search_extend', width: '80', title: '搜索扩展信息',sort: parseInt('1'),templet: function(d){
                    return d.search_extend?d.search_extend:'';
                }},

        ];

        //son子模板$cols扩展编辑项
        typeof self_extend_cols === "function" ? ($cols = self_extend_cols($cols,layui)) : false;

        //通用调用
        layui.$cols = $cols,layui.$ThisGet = '',layui.$class = 'Form',layui.$this_id = 'form_id',layui.$table = 'ca_form';
        chinAdmin.index(layui);

        //编辑删除操作
        table.on('tool(currentTableFilter)', function (obj) {

            var data = obj.data;

            typeof self_extend === "function" ? self_extend(obj, layui) : false;

            if (obj.event === 'generateCode_create') {
                window.open("/chinadmin/admin/Form/showOneField_create?MT=1&id="+ data[layui.$this_id]);
                return false;
            }

            if (obj.event === 'generateCode_index') {
                window.open("/chinadmin/admin/Form/showOneField_index?MT=1&id="+ data[layui.$this_id]);
                return false;
            }

            if (obj.event === 'edit') {

                var index = layer.open({
                    title: '编辑',
                    type: 2,
                    shade: 0.2,
                    maxmin: true,
                    shadeClose: true,
                    area: ['100%', '100%'],
                    content: "/chinadmin/admin/" + layui.$class + "/create?id=" + data[layui.$this_id],
                });

                return false;

            } else if (obj.event === 'delete') {

                layer.confirm('真的删除行么', function (index) {

                    $.ajax({
                        type: "POST",
                        url: "/chinadmin/admin/" + layui.$class + "/del",
                        timeout: 100000, //超时时间设置，单位毫秒 为一秒
                        data: {
                            'id': data[layui.$this_id]
                        },
                        dataType: "json",      //如果有此选项成功返回的json会自动变成对象，如果没有需要用JSON.parse()转换
                        success: function (data) {
                            layer.msg(data.msg);
                        }
                    });

                    //界面效果
                    obj.del();
                    layer.close(index);

                });

            }
        });

    });
</script>



































</body>
</html>
